<template>
	<view class="Global">
		<!-- 背景图片铺满 -->
		<!-- <image class="imagepage" src="/static/background@2x.png" mode=""></image> -->
		<bgImage></bgImage>
		<MyNav :title="title" bgColor="" :backIcon="isback"></MyNav>



		<view class="content">

			<view class="contentItem">

				<view class="contentTop">
					<view class="contentTopLeft">
						<text class="contentTopLeftTop">原密码</text>

					</view>

					<view class="contentTopRight">
						<input @input="onInputOld" type="text" class="contentRightInput"
							placeholder-class="contentRightInputPlace" placeholder="请输入" />

					</view>
				</view>
				
				
				<view class="contentTop">
					<view class="contentTopLeft">
						<text class="contentTopLeftTop">新密码</text>

					</view>

					<view class="contentTopRight">
						<input @input="onInputNew" type="text" class="contentRightInput"
							placeholder-class="contentRightInputPlace" placeholder="请输入" />

					</view>
				</view>
				<view class="contentTop"  v-show="false">
					<view class="contentTopLeft">
						<text class="contentTopLeftTop">确认密码</text>

					</view>

					<view class="contentTopRight">
						<input @input="onInputConfirm" type="text" class="contentRightInput"
							placeholder-class="contentRightInputPlace" placeholder="请输入" />

					</view>
				</view>

			</view>

		</view>


		<view class="loginContent">

			<button @click="loginClick()" style="color:#ffffff" class="login" type="default">{{login}}</button>
		</view>


	</view>
</template>

<script>
	import MyNav from '@/components/customnavbar.vue'
	import bgImage from '@/components/backgroundImage.vue'
	import {

		updatePwd
	} from '@/pages/api/api.js'


	export default {
		components: {
			MyNav,
			bgImage,


		},

		data() {
			return {
				title: '修改密码',
				isback: true,
				login: '确定',


				dataList: [{
						title: '原密码',
						value: '123'
					},
					{
						title: '新密码',
						value: '123'
					},
					{
						title: '确认密码',
						value: '123'
					}
				],

				addSizeManagerData: {
					oldPassword: '',
					newPassword: '',
					

				}

			}
		},
		methods: {
			// 获取编号输入框的值
			onInputOld(e) { 

				this.addSizeManagerData.oldPassword = e.detail.value
				console.log('获取录入值', e.detail.value);

			},
			onInputNew(e) {
				this.addSizeManagerData.newPassword = e.detail.value
				console.log('获取录入值', e.detail.value);

			},
			onInputConfirm(e) {
				// this.addSizeManagerData.rawPassword = e.detail.value
				console.log('获取录入值', e.detail.value);

			},
			// 修改密码  

			loginClick() {

				updatePwd(this.addSizeManagerData).then((res) => {
					// console.log('新增数据', res);

					if (res.code == 200) {
						// 表示添加成功 则返回上一页
						uni.showToast({
							title: ''+res.msg,
							icon:'none'
						});

						uni.navigateBack({
							delta: 1
						});

					}
					// 显示提示信息
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});

				}).catch((err) => {
					console.log('新增失败', err);
				});
			}



		}
	}
</script>

<style>
	.loginContent {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 100%;



	}

	.login {
		display: flex;
		justify-content: center;

		width: 630rpx;
		height: 100rpx;

		border-radius: 30rpx;
		font-weight: 400;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		font-weight: bold;
		margin-top: 30rpx;

		margin-bottom: 30rpx;



		background: linear-gradient(90deg, #45A8FF, #0AE1C6);

	}

	.contentTopRightImg {
		width: 16rpx;
		height: 9rpx;
		margin-left: 10rpx;
		margin-right: 30rpx;
	}

	.contentTopRightText {
		display: flex;
		font-family: HarmonyOS Sans SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #666666;
		line-height: 120rpx;
	}

	.contentTopRight {
		display: flex;
		justify-content: center;
		align-items: center;

	}

	.contentRightInputPlace {

		font-size: 28rpx;
	}

	.contentRightInput {

		display: flex;
		width: 100rpx;
	}

	.contentTopLeftBottom {
		display: flex;

		color: #FF7D58;
	}

	.contentTopLeftTop {
		display: flex;

		font-family: HarmonyOS Sans SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #333333;
		line-height: 120rpx;
		margin-left: 30rpx;
	}

	.contentTopLeft {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.contentTop {
		height: 120rpx;
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: #EEEEEE 1rpx solid;


	}

	.contentTop1 {
		height: 120rpx;
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;



	}

	.contentItem {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		width: 100%;

	}

	.content {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		width: 690rpx;
		margin-top: 30rpx;
		background: #FFFFFF;
		border-radius: 30rpx;
	}
</style>